package View;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

public class ClientChatRoomFrame extends JFrame{
	
	private String name;
	
	JPanel contentPane = new JPanel();
	
	JTextField newMessage= new JTextField();
	
	final JButton send = new JButton("Send");
	
	
	
	public ClientChatRoomFrame(String name){
		
		this.name = name;
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setLocationRelativeTo(null);
		setSize(400, 500);
		setTitle("Chat room : " + name);	
		
		
		contentPane.setBorder(new EmptyBorder(10, 10, 10, 10));
		contentPane.setLayout(new BorderLayout(10, 10));

		setContentPane(contentPane);
		
		////////////////// Console //////////////////////////
		
		JPanel console = new JPanel();
		console.setPreferredSize(new Dimension(350,400));
		
		console.setLayout(new BorderLayout());

		

		JScrollPane consoleScroll = new JScrollPane();
		consoleScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

	    console.add(consoleScroll, BorderLayout.CENTER);
	
		
		contentPane.add(console, BorderLayout.CENTER);
		
		
		////////////////// Users connected //////////////////
		
		//  ?
		
		
		///////////////// Text field to write messages /////////////////
		
		JPanel messages = new JPanel();
		messages.setLayout(new BorderLayout());
		messages.add(newMessage, BorderLayout.CENTER);
		messages.add(send, BorderLayout.EAST);
		
		contentPane.add(messages, BorderLayout.SOUTH);
		
		
		
		setLocationRelativeTo(null);

		setVisible(true);	
	}
	
	public static void main(String argv[])
	{
		ClientChatRoomFrame clientMain = new ClientChatRoomFrame("egjzmjfmz");
	}
	
	

}
